package com.xwyzsn.backend.job.controller;


import com.xwyzsn.backend.job.common.Result;
import com.xwyzsn.backend.job.service.impl.TeacherServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import org.springframework.stereotype.Controller;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author xwyzsn
 * @since 2023-03-03
 */
@RestController
@RequestMapping("/job/teacher")
@CrossOrigin(origins = "*", maxAge = 3600)
public class TeacherController {


    @Autowired
    private TeacherServiceImpl teacherService;

    @GetMapping("/getinfo")
    public Result getInfo(@RequestParam("tnum") String tnum){
        return teacherService.getInfo(tnum);
    }

    @GetMapping("getproject")
    public Result getProject(@RequestParam("tnum") String tnum){
        return teacherService.getProject(tnum);
    }

    @PostMapping("/update")
    public Result update(@RequestParam("tnum") String tnum,
                         @RequestParam("tname") String tname,
                         @RequestParam("age") Integer age,
                         @RequestParam("qq") String tqq,
                         @RequestParam("email") String tmail,
                         @RequestParam("tel") String tphone,
                         @RequestParam("dept") String tdept,
                         @RequestParam("ttile") String ttitle,
                         @RequestParam("location") String location,
                         @RequestParam("password") String password){
        return teacherService.updateTeacher(tnum,tname,age,tqq,tmail,tphone,tdept,ttitle,location,password);
    }

    @GetMapping("getdeptteacher")
    public Result getDeptTeacher(@RequestParam("dept") String dept){
        return teacherService.getDeptTeacher(dept);
    }


}
